#include "StdAfx.h"

#include "FrameForm.h"
#include "AddFrameDlg.h"
#include "./Scene/Scene.h"

System::Void myui::FrameForm::FrameForm_Load( System::Object^ sender, System::EventArgs^ e )
{
	
	if(FrameForms == nullptr)
		FrameForms = gcnew	System::Collections::Generic::Dictionary<System::String^, myForm^>();
	AddFrameDlg^ dlg = gcnew AddFrameDlg();
	dlg->ShowDialog(this);
	this->Text = dlg->getFrameName();
	FrameForms->Add(dlg->getFrameName(),this);

	op = new Operation();
}

System::Void myui::FrameForm::FrameForm_FormClosed( System::Object^ sender, System::Windows::Forms::FormClosedEventArgs^ e )
{
	Form^ form = (Form^)sender;
	if( form != nullptr)
	{
		FrameForms->Remove(form->Text);
		form->Hide();
		form->Close();
	}

	delete op;
	op = 0;
}

System::Void myui::FrameForm::FrameForm_MouseUp( System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e )
{
	this->Cursor = op->MouseOp(e->X, e->Y,Operation::MouseUp,e->Button);
}

System::Void myui::FrameForm::FrameForm_MouseDown( System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e )
{
	this->Cursor = op->MouseOp(e->X, e->Y,Operation::MouseDn,e->Button);
}

System::Void myui::FrameForm::FrameForm_MouseMove( System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e )
{
	this->Cursor = op->MouseOp(e->X, e->Y,Operation::MouseMv,e->Button);
}

System::Void myui::FrameForm::FrameForm_MouseEnter( System::Object^ sender, System::EventArgs^ e )
{

}

System::Void myui::FrameForm::FrameForm_MouseLeave( System::Object^ sender, System::EventArgs^ e )
{

}